package main

import (
	"fmt"
	"github.com/go-redis/redis"
)

var rdb *redis.Client

func main() {
	rdb = redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
		PoolSize: 100,
	})
	_, err := rdb.Ping().Result()
	if err != nil {
		fmt.Println("初始化redis：连接失败")
	} else {
		fmt.Println("初始化redis：连接成功")
	}

	err = rdb.Set("score", 1000, 0).Err()
	if err != nil {
		fmt.Println(" 写入失败")
		return
	}
}
